import java.util.Scanner;
public class GuessPricePlus {
	public static void main(String[]args){
		int x=1;
		int totalscores=0;
		do{
			Scanner input=new Scanner(System.in);
			int a=(int)(Math.random()*100);
			int flag=0;
			int score=100;
			for(int i=5;i>=1;){
				System.out.println("Please guess the price of the goods:");
				int b=input.nextInt();
				i--;
				flag++;
				if(a==b){
					totalscores+=score;
					System.out.println("You are right,the price is: "+a+"        you guess "+flag+" times");
					System.out.println("You score is :"+score);
					break;
				}else{
					if(b>a){
						score-=20;
						System.out.println("You guess is expensive");
						System.out.println("You still have "+i+" times");
					}if(b<a){
						score-=20;
						System.out.println("You guess is cheap");
						System.out.println("You still have "+i+" times");
					}
				}
				if(i==0){
					System.out.println("The truly price of the good is: "+a);
					System.out.println("You score is :"+score);
				}
			}
			System.out.println("Now,you can chose:  1.stop this game  0.play one more time");
			System.out.println("If you don't want to play again,pless press 1 ");
			x=input.nextInt();
		}while(x!=1);
		System.out.println("You total score is :"+totalscores);
	}
}
